package jeons.admin.product.biz.impl;

import jeons.admin.product.biz.ProductImgBiz;
import jeons.admin.product.dto.ProductImgDTO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional

public class ProductImgBizImpl extends SqlMapClientDaoSupport implements ProductImgBiz{
	@Autowired SqlMapClientTemplate sqlMapClientTemplate;

	@Override
	public void uploadImgData(ProductImgDTO productImgDTO) {
		if (productImgDTO.getProno() != null) {
			
			sqlMapClientTemplate.insert("ProductImg.insertData",productImgDTO);
		}else{
			sqlMapClientTemplate.update("ProductImg.updateData",productImgDTO);
		}
		
	}

	@Override
	public ProductImgDTO getData(int prono) {
		return (ProductImgDTO) sqlMapClientTemplate.queryForObject("ProductImg.getData",prono);
	}
}
